﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
using WillCallLib;

namespace WillCallWeb.BaseClasses
{
    public abstract class BaseUserControl : System.Web.UI.UserControl
    {

        public abstract Object Item { get; set; }
        public abstract int Key { get; set; }
        public abstract void ChangeMode();

        protected EventContext ctx = new EventContext();

        public delegate void ItemSelectedHandler(int Id);
        public event ItemSelectedHandler ItemSelected;


        protected void OnItemSelected(int Id)
        {
            if (ItemSelected != null) ItemSelected(Id);
        }

        public enum Modes
        {
            Edit,
            List
        }
        private Modes _mode;
        public Modes Mode
        {
            get { return _mode; }
            set { _mode = value; ChangeMode(); }
        }
    }
}